<div class="container_24"><?php echo form_open('admin/channel/index');?>
<div class="grid_2" style="padding-top: 10px"><label>Chanel:</label></div>
<div class="grid_7"><?php
$options=array();
foreach($channelList as $l){
	$options[(string)($l->id)] = $l->name;
}
echo form_dropdown('channel_id',$options,$metaModel["channel_id"]);
?></div>
<div class="grid_1" style="padding-top: 10px"><label> From</label></div>
<div class="grid_5"><input type="text" id="fromdate" name="fromdate"
	value="<?php echo $metaModel["fromdate"];?>" readonly="readonly" /></div>
<div class="grid_1" style="padding-top: 10px"><label> To</label></div>
<div class="grid_5"><input type="text" id="todate" name="todate"
	value="<?php echo $metaModel["todate"];?>" readonly="readonly" /></div>
<div class="grid_2"><input type="submit" /></div>
<div class="clear"></div>

<?php echo form_close();?></div>
<?php
foreach ($dateList as $date){?>
<div class="clear"></div>
<section class="title">
<h4>Result at: <?php echo $date;?></h4>
<a class="button edit"
	href="index.php/admin/channel/edit?channel_id=<?php echo $metaModel["channel_id"];?>&open_date=<?php echo $date;?>">Edit</a>
</section>

<section class="item">
<div class="content">

<table cellspacing="0" border="0" class="table-list">
	<tbody>
	<?php
	$detail =$detailList[$date];
	$itemCount=sizeof($detail);
	$colCount = 4;
	$rowCount=$itemCount%$colCount==0?$itemCount/$colCount:$itemCount/$colCount+1;
	$rowCount=intval($rowCount);
	$itemIndex=0;
	for($i=0;$i<$rowCount;$i++)
	{
		?>
		<tr>
		<?php for($j=0;$j<$colCount;$j++){
			$prize = $itemIndex<$itemCount?"Prize ".$detail[$itemIndex]->prize:"";
			$result = $itemIndex<$itemCount?$detail[$itemIndex]->result:"";
			$itemIndex++;
			?>
			<td><?php echo $prize;?></td>
			<td style="border-right: 1px solid #DDDDDD"><?php echo $result;?></td>
			<?php
		}
		?>
		</tr>
		<?php
	}
	?>
	</tbody>
</table>

</div>
</section>
	<?php }?>
<script type="text/javascript">
$(window).load(function() {
	Channel.initIndex();
});
</script>